package com.hainatong.shiphelper.module.holiday.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder;
import com.hainatong.shiphelper.R;
import com.hainatong.shiphelper.databinding.ItemHolidayHistoryViewBinding;
import com.hainatong.shiphelper.module.holiday.entity.UserVacationBean;
import org.jetbrains.annotations.NotNull;

public class HolidayHistoryAdapter extends BaseQuickAdapter<UserVacationBean, BaseDataBindingHolder<ItemHolidayHistoryViewBinding>>
{
    public HolidayHistoryAdapter()
    {
        super(R.layout.item_holiday_history_view);
    }

    @Override
    protected void convert(@NotNull BaseDataBindingHolder<ItemHolidayHistoryViewBinding> bindingHolder, UserVacationBean vacationBean)
    {
        ItemHolidayHistoryViewBinding binding = bindingHolder.getDataBinding();
        if( binding != null )
        {
            // 1 已申请  2 审核中 3 通过  4 驳回
            int status = Integer.parseInt( vacationBean.getStatus() );
            switch ( status )
            {
                case 1:
                    binding.tvStatus.setText("已申请 ");
                    break;
                case 2:
                    binding.tvStatus.setText("审核中 ");
                    break;
                case 3:
                    binding.tvStatus.setText("审核通过");
                    break;
                case 4:
                    binding.tvStatus.setText("驳回 ");
                    break;
                default:
                    binding.tvStatus.setText("已申请 ");
                    break;
            }


            binding.setVacationBean( vacationBean );
            binding.executePendingBindings();
        }
    }
}
